package com.SpringBo.deliver.service;


import org.apache.commons.lang3.time.DateFormatUtils;
import org.thymeleaf.util.DateUtils;

import java.util.Date;

public class TestDeliverService {
     private static int count = 0;

     public static void sendMessage(String json) throws Exception {
         if(count==50){
             Thread.sleep(2000);
             count = 0;
         }
         count++;
         System.out.println("消息"+json+"与"+ DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss") +"投递");
     }


    public static void main(String[] args) throws Exception {
        for(int i=0;i<300;i++){
            sendMessage("开始发送"+i);
        }
    }

}
